package org.logic.linguisticSummaries.type1summaries;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import org.logic.fuzzysets.AFuzzySet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SummaryTypeOneContainer {

	private static Logger logger = LoggerFactory.getLogger(SummaryTypeOneContainer.class);
	
	protected List<AFuzzySet> quantifiers;
	protected List<AFuzzySet> summarizers;
	protected List<String> subjects;
	
	public SummaryTypeOneContainer() {
		quantifiers = new ArrayList<AFuzzySet>();
		summarizers = new ArrayList<AFuzzySet>();
		subjects = new ArrayList<String>();
	}
	
	public void addQuantifier(AFuzzySet quantifier){
		quantifiers.add(quantifier);
	}
	
	public void addSummarizer(AFuzzySet summarizer){
		summarizers.add(summarizer);
	}
	
	public void addSubject(String subject){
		subjects.add(subject);
	}
	
	public Map<Double,String> generateAllSummaries(){
		
		logger.info("\n============================ TYPE 1 ============================");
		Map<Double,String> summaries = new TreeMap<Double,String>();

		for (AFuzzySet quantifier : quantifiers) {
			for (String subject : subjects) {
				for (AFuzzySet summarizer : summarizers) {

					SummaryTypeOne summaryTypeOne = new SummaryTypeOne(subject, quantifier, summarizer);
					String summary = summaryTypeOne.generateSummary();
					summaries.put(summaryTypeOne.getDegreeOfTruth(),summary);
					//logger.info(summary);
				}
			}

		}
		return summaries;
	}

}
